package(default_visibility = ["//visibility:public"])

cc_library(
  name="tf_seg_model",
  srcs=[
    "tf_seg_model.cc"
  ],
  hdrs=[
    "tf_seg_model.h"
  ],
  deps=[
   '//utils:basic_string_util',
   '//utils:basic_vocab',
   ':sentence_breaker',
   ':ac_scanner',
   '@org_tensorflow//tensorflow/core:tensorflow',
  ]
)

cc_library(
  name="sentence_breaker",
  srcs=[
    "sentence_breaker.cc"
  ],
  hdrs=[
    "sentence_breaker.h"
  ],
  copts=[
  "-Wno-writable-strings"
  ],
  deps=[
  '//base:base',
   '//utils:basic_string_util',
  ],
  linkstatic=1,
)

cc_binary(name="test_breaker",
srcs=[
  'test_breaker.cc',
],
deps=[
  '//base:base',
  ':sentence_breaker',
],
linkopts=[
'-ldl',
'-lpthread',
],
copts=[
'-g','-std=c++11'])


py_binary(
    name = "dump_vocab",
    srcs = ["dump_vocab.py"],
    data=['//utils:w2v.so'],
    imports=['../../utils']
)

cc_binary(name="test_seg",
srcs=[
  'test_seg.cc',
],
deps=[
  ':tf_seg_model',
  '//base:base',
],
linkopts=[
'-ldl',
'-lpthread',
],
copts=[
'-g','-std=c++11'])


cc_binary(name="gen_seg_eval",
srcs=[
  'gen_seg_eval.cc',
],
deps=[
  ':tf_seg_model',
  '//base:base',
],
linkopts=[
'-ldl',
'-lpthread',
],
copts=[
'-g','-std=c++11'])



genrule(
    name = "demo_html_gen",
    srcs = ["demo.html"],
    outs = ["demo_html.h"],
    cmd = "xxd -i \"$<\"  >\"$@\""
)
cc_library(
    name = "demo_html",
    srcs = ["demo_html.h"],
    data=[
    ':demo_html_gen'
    ]
)


cc_binary(name="seg_backend_api",
  srcs=[
  'seg_backend_api.cc',
  ],
  linkopts=['-ldl'],
  deps=[
  ':demo_html',
  ':tf_seg_model',
  '//base:base',
  '//utils:jsonxx',
  '//third_party/crow:crow',
  ])


cc_library(
  name="ac_scanner",
  srcs=[
    "ac_scanner.h",
    "scan_reporter.h"
  ],
  deps=[
  '//base:base',
   '//utils:basic_string_util',
  ],
  linkstatic=1,
)


cc_binary(name="test_ac_scanner",
  srcs=[
  'test_ac_scanner.cc',
  ],
  linkopts=['-ldl'],
  copts=[
  "-Wno-writable-strings",
  ],
  deps=[
  ':ac_scanner',
  ])
